
local depvar " pm25"
local cluslvl "id_mills"

*Column 1: pollution fires
use "$dataDir/dataset_pollution_harvest_daily_weather", clear

foreach var in `depvar'{
	reghdfe `var' afterXtreatment temp_celsius rain rain2, abs(id_mills i.year#i.month) vce(cluster `cluslvl')
		estimates store `var'_treat_did_firep
		qui sum `var' if e(sample)==1 & year<2015
		local mean1=r(mean)
		estadd scalar mean1 `mean1' : `var'_treat_did_firep
		estadd local moyearfe "Yes"
		estadd local yearfe "No"
		estadd local millfe "Yes"	
		estadd local cluslvl "Mill"
		estadd local wc "Yes"
			
	}
	
*Column 2: pollution mills
use "$dataDir/dataset_pollution_mills_year_weather", replace
		
	foreach var in `depvar'{
	reghdfe `var' afterXtreatment temp_celsius rain rain2, abs(id_mills i.year) vce(cluster `cluslvl')
		estimates store `var'_treat_did_millp
		qui sum `var' if e(sample)==1 & year<2015
		local mean1=r(mean)
		estadd scalar mean1 `mean1' : `var'_treat_did_millp
		estadd local yearfe "Yes"
		estadd local moyearfe "No"
		estadd local millfe "Yes"	
		estadd local cluslvl "Mill"
		estadd local trend "No"
		estadd local wc "Yes"
			
	}
	
		esttab pm25_treat_did_firep pm25_treat_did_millp using "$mainDir/tables/Tab4_main_pollution.tex", replace b(%12.3fc) se(%12.3fc) keep(afterXtreatment)  varlabels(afterXtreatment  "After 2015 $\times$ Regulated") mtitle(" & \multicolumn{1}{c}{Pollution in fields} & \multicolumn{1}{c}{Pollution in mills} \\ &PM_{2.5} &PM_{2.5}  \\") label starl(* 0.1 ** 0.05 *** 0.01) stats(mean1 N r2 yearfe moyearfe millfe wc cluslvl, fmt(%12.3fc %12.0fc %12.3fc) label("Pre 2015 Mean" "Obs." "R-squared" "Year FE" "Month by Year FE" "Mill FE" "Weather controls" "Cluster level")) nonotes